//
//  OrderSureDataModel.swift
//  XiaoJingMallSwift
//
//  Created by beisheng03 on 2017/8/25.
//  Copyright © 2017年 beisheng. All rights reserved.
//

import UIKit

class OrderSureDataModel: NSObject {
    var available_predeposit = "-999"
    var bean_desc = "-999"
    var address_info : AddressInfoModel?
    var available_bean_amount = "-999"
    var set_paypwd_url = "-999"
    var available_predeposit_amount = "-999"
    var available_bean = "-999"
    var freight_hash = "-999"
    var available_gold = "-999"
    var gold_desc = "-999"
    var payment_list = [PaymentListModel]()
    var predeposit_desc = "-999"
    var shipping_fee = "-999"
    var available_gold_amount = "-999"
    var order_amount = "-999"
    var paypwd_state = "0"
    var needPayMoney = "0.0"
    var GBPModels = [GBPInfoModel]()
    var useGoldBean = false
    var payWay : String?


    
    init(dic : [String : AnyObject]) {
        super.init()
        
        setValuesForKeys(dic)
        
    }
    
    
    override func  setValue(_ value: Any?, forKey key: String) {
        
        if key == "address_info" {
            
            if let temp = value as? [String : AnyObject]{
                
                address_info = AddressInfoModel(dic:temp )
                
            }
            
        } else if key == "payment_list" {
            
            if let temp = value as? [[String : AnyObject]]{
                
                for dic in temp {
                    
                    payment_list.append(PaymentListModel(dic:dic ))
                }
                
                
            }
            

            
            
        }else{
        
        
            super.setValue(value, forKey: key)

        
        }
        
    }
    
    override func setValue(_ value: Any?, forUndefinedKey key: String) {
        
        
    }
    
   

    //在swift中想要打印对象要以下重写属性
    override var description: String{
        let keys = ["available_predeposit","bean_desc","address_info","available_bean_amount","set_paypwd_url","available_predeposit_amount","available_bean","freight_hash","available_gold","gold_desc","payment_list","predeposit_desc","shipping_fee","available_gold_amount","order_amount","paypwd_state"]
        let dic = dictionaryWithValues(forKeys: keys)
        return "\(dic)"
    }




}
